import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'panel_my.dart';
import 'panel_query_word.dart';
import 'panel_review.dart';
import 'panel_wordbook.dart';

class PanelRight extends StatefulWidget {
  const PanelRight({super.key});

  @override
  State<PanelRight> createState() => _PanelRightState();
}

class _PanelRightState extends State<PanelRight>
    with SingleTickerProviderStateMixin {
  var _tabController;
  late PanelQueryWord _queryWordPanel;
  late PanelWordBook _wordBookPanel;
  late PanelReview _reviewPanel;
  late PanelMy _myPanel;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    _tabController = TabController(length: 4, vsync: this);

    _queryWordPanel = PanelQueryWord();
    _wordBookPanel = PanelWordBook();
    _reviewPanel = PanelReview();
    _myPanel = PanelMy();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      child: Column(
        children: [
          TabBar(
            tabs: [Text("查单词"), Text("单词本"), Text("复习"), Text("我的")],
            controller: _tabController,
          ),
          Expanded(
            child: TabBarView(
              children: [
                _queryWordPanel,
                _wordBookPanel,
                _reviewPanel,
                _myPanel
              ],
              controller: _tabController,
            ),
          )
        ],
      ),
    );
  }
}
